package com.lifu.yygh.hosp.controller;

import com.lifu.yygh.common.result.Result;
import com.lifu.yygh.hosp.service.HospitalService;
import com.lifu.yygh.model.hosp.Hospital;
import com.lifu.yygh.vo.hosp.HospitalQueryVo;
import com.lifu.yygh.vo.hosp.HospitalSetQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Description
 * @Author lifu
 * @Date 2021/5/14 16:15
 */
@Api(tags = "医院列表管理")
@RestController
@RequestMapping(value = "/admin/hosp/hospital")
public class HospitalController {
    @Autowired
    private HospitalService hospitalService;

    //医院列表
    @ApiOperation(value = "医院列表分页查询")
    @GetMapping("list/{page}/{limit}")
    public Result listHosp(@PathVariable Integer page, @PathVariable Integer limit, HospitalQueryVo hospitalQueryVo){
        Page<Hospital> pageModel = hospitalService.selectHospPage(page,limit,hospitalQueryVo);
        return Result.ok(pageModel);
    }
    @ApiOperation(value = "更新医院上线状态")
    @GetMapping("/updateStatus/{id}/{status}")
    public Result updateStatus(@PathVariable String id,@PathVariable Integer status){
        hospitalService.updateStatus(id,status);
        return Result.ok();
    }
    @ApiOperation(value = "查询医院详情信息")
    @GetMapping("/showHospDetail/{id}")
    public Result showHospDetail(@PathVariable String id){
        Map<String,Object> map = hospitalService.getHospById(id);
        return Result.ok(map);
    }
}
